﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace BlogManager.Application.Controls
{
    public partial class SelectedSite : System.Web.UI.UserControl
    {
        private int? SiteId = null;

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(Request.QueryString["SiteId"]))
                SiteId = Convert.ToInt32(Request.QueryString["SiteId"]);

            if (SiteId == null)
                return;

            var site = Data.Entities.Site.All().SingleOrDefault(x => x.Id == SiteId);
            if (site != null)
                LiteralForSelectedSite.Text = "<b>Selected Site: </b>"+site.Url;
        }
    }
}